package model;

import java.sql.*;

/**
 * Mysql连接类
 * @author faith
 *
 */
public class ConnectDB {
	Connection con = null;
	public ConnectDB() {
		try {
			Class.forName("com.mysql.cj.jdbc.Driver");		// 加载MySQL驱动
		} catch (Exception e) {
			System.out.println(e);
		}
		
		String url = "jdbc:mysql://localhost:3306/blog?characterEncoding=utf-8";
		String user = "test";
		String password = "123456";
		try {
			con = DriverManager.getConnection(url,user,password);
		}catch(SQLException e) {
			System.out.println(e);
		}
	}
}
